<!--
  @author nowind
  @since 17/07/23 14:34
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::confJscss"/>
<title>新增或编辑回访问题</title>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">

        <div class="layui-card-body">

            <form method="post" action="" class="layui-form" lay-filter="zmn-form">

                <input type="hidden" name="questionId" th:value="${question.questionId}"/>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">回访问题：</label>
                    <div class="layui-input-inline" style="width: 390px">
                        <input type="text" name="question" th:value="${question.question}" lay-verify="required" autocomplete="off" class="layui-input" maxlength="50"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">答案类型：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="answerType" lay-filter="answerType" value="1" title="单选"
                               th:checked="${question.answerType == 1 || question.questionId == null }">
                        <input type="radio" name="answerType" lay-filter="answerType" value="2" title="多选" th:checked="${question.answerType == 2}">
                        <input type="radio" name="answerType" lay-filter="answerType" value="3" title="手动输入" th:checked="${question.answerType == 3}">
                    </div>
                </div>

<!--                <div class="layui-form-item" id="singleChooseDiv" th:style="${question.answerType == null || question.answerType == 1 ? '' : 'display: none'}">-->
<!--                    <label class="layui-form-label layui-form-required">答案：</label>-->
<!--                    <div class="layui-input-block">-->
<!--                        <zmn th:each="item:${returnVisitAnswers}">-->
<!--                            <input type="radio" name="answer" lay-filter="answer" th:title="${item.answer}"-->
<!--                                   th:value="${item.answerId}" th:checked="${question.answerIdStr != null && question.answerIdStr.indexOf('$'+item.answerId+'$')!=-1}">-->
<!--                        </zmn>-->
<!--                    </div>-->
<!--                </div>-->

                <div class="layui-form-item" id="multiChooseDiv">
                    <label class="layui-form-label layui-form-required">答案：</label>
                    <div class="layui-input-block">
                        <zmn th:each="item:${returnVisitAnswers}">
                            <input type="checkbox" name="answer" lay-filter="answer" th:title="${item.answer}"
                                   th:value="${item.answerId}" th:checked="${question.answerIdStr != null && question.answerIdStr.indexOf('$'+item.answerId+'$')!=-1}">
                        </zmn>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">业务类型：</label>
                    <div class="layui-input-block">
                        <zmn th:each="item:${bizTypeList}">
                            <input type="checkbox" name="bizType" th:value="${item.key}" th:title="${item.value}"
                                   th:checked="${question.bizType != null && question.bizType.indexOf(item.key+'') != -1}">
                        </zmn>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">回访类别：</label>
                    <div class="layui-input-block">
                        <zmn th:each="item:${returnVisitCategorys}">
                            <input type="checkbox" name="category" lay-filter="category" th:title="${item.name}"
                                   th:value="${item.categId}" th:checked="${question.answerCategStr != null && question.answerCategStr.indexOf('$'+item.categId+'$')!=-1}">
                        </zmn>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">排序：</label>
                    <div class="layui-input-inline">
                        <input type="number" name="sort" autocomplete="off" class="layui-input" th:value="${question.sort}"
                               lay-verify="isPositiveNumber"  onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')">
                    </div>
                </div>

                <!--<div class="layui-form-item">-->
                    <!--<label class="layui-form-label layui-form-required">服务平台：</label>-->
                    <!--<div class="layui-input-block">-->
                        <!--<zmn th:if="${question.questionId == null}">-->
                            <!--<input type="checkbox" name="plat" value="10" title="啄木鸟"-->
                                   <!--th:checked="true">-->
                        <!--</zmn>-->
                        <!--<zmn th:if="${question.questionId != null}">-->
                            <!--<input type="checkbox" name="plat" value="10" title="啄木鸟"-->
                                   <!--th:checked="${question.plat != null && question.plat.indexOf('$10$') != -1}">-->
                        <!--</zmn>-->
                        <!--<input type="checkbox" name="plat" value="20" title="言而有信"-->
                               <!--th:checked="${question.plat != null && question.plat.indexOf('$20$') != -1}">-->
                        <!--<input type="checkbox" name="plat" value="40" title="川南环保"-->
                               <!--th:checked="${question.plat != null && question.plat.indexOf('$40$') != -1}">-->
                        <!--<input type="checkbox" name="plat" value="30" title="一步生活"-->
                               <!--th:checked="${question.plat != null && question.plat.indexOf('$30$') != -1}">-->
                    <!--</div>-->
                <!--</div>-->

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">状态：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" value="1" title="停用"
                               th:checked="${question.status == 1 || question.questionId == null }">
                        <input type="radio" name="status" value="2" title="启用" th:checked="${question.status == 2}">
                    </div>
                </div>

                <div class="layui-form-item submit">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="zmn-form-submit">提交
                        </button>
                        <button class="layui-btn layui-btn-primary" id="cancel">取消</button>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
</body>
</html>
<script type="text/javascript" th:inline="javascript">
    var json = {
        question: [[${question}]]
    };
    layui.config({
        base: "/static/lay/",
        version: version
    }).extend({
        index: "lib/index",
        oms_conf_reply_question_detail:  "conf/reply/question/zmn.oms.conf.reply.question.detail",
    }).use(['index', 'oms_conf_reply_question_detail']);
</script>
